package com.felight.list;

/**
 * Student class is created which implements comparable interface and compareTo
 * method is overridden
 * 
 * @author soumya
 * 
 */
public class Student implements Comparable<Object> {
	String name;
	double perc;

	public Student(String name, double perc) {
		this.name = name;
		this.perc = perc;
	}

	@Override
	public int compareTo(Object o) {
		if (o instanceof Student) // Checking for instance
		{
			Student s = (Student) o; // Typecasting o to Student
			if (this.perc == s.perc) {
				return 0;
			} else if (this.perc > s.perc) {
				return 1;
			} else {
				return -1;
			}
		} else {
			return 0;
		}
	}

}